<div class="row justify-content-center">
    <div class="col-8">
        <form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
            <h2 id="jhi-bank-account-heading" jhiTranslate="jhipsterSampleApplicationApp.bankAccount.home.createOrEditLabel">Create or edit a Bank Account</h2>

            <div>
                <jhi-alert-error></jhi-alert-error>

                <div class="form-group" [hidden]="!editForm.get('id')!.value">
                    <label for="id" jhiTranslate="global.field.id">ID</label>
                    <input type="text" class="form-control" id="id" name="id" formControlName="id" readonly />
                </div>

                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="jhipsterSampleApplicationApp.bankAccount.name" for="field_name">Name</label>
                    <input type="text" class="form-control" name="name" id="field_name"
                           formControlName="name"/>
                    <div *ngIf="editForm.get('name')!.invalid && (editForm.get('name')!.dirty || editForm.get('name')!.touched)">
                        <small class="form-text text-danger"
                               *ngIf="editForm.get('name')?.errors?.required" jhiTranslate="entity.validation.required">
                        This field is required.
                        </small>
                    </div>
                </div>

                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="jhipsterSampleApplicationApp.bankAccount.balance" for="field_balance">Balance</label>
                    <input type="number" class="form-control" name="balance" id="field_balance"
                           formControlName="balance"/>
                    <div *ngIf="editForm.get('balance')!.invalid && (editForm.get('balance')!.dirty || editForm.get('balance')!.touched)">
                        <small class="form-text text-danger"
                               *ngIf="editForm.get('balance')?.errors?.required" jhiTranslate="entity.validation.required">
                        This field is required.
                        </small>
                        <small class="form-text text-danger"
                            [hidden]="!editForm.get('balance')?.errors?.number" jhiTranslate="entity.validation.number">
                            This field should be a number.
                        </small>
                    </div>
                </div>

                <div class="form-group">
                    <label class="form-control-label" jhiTranslate="jhipsterSampleApplicationApp.bankAccount.user" for="field_user">User</label>
                    <select class="form-control" id="field_user" name="user" formControlName="user">
                        <option [ngValue]="null"></option>
                        <option [ngValue]="userOption.id === editForm.get('user')!.value?.id ? editForm.get('user')!.value : userOption" *ngFor="let userOption of users; trackBy: trackById">{{ userOption.login }}</option>
                    </select>
                </div>
            </div>

            <div>
                <button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
                    <fa-icon icon="ban"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
                </button>

                <button type="submit" id="save-entity" [disabled]="editForm.invalid || isSaving" class="btn btn-primary">
                    <fa-icon icon="save"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
                </button>
            </div>
        </form>
    </div>
</div>
